package com.itheima.mapper;

import com.itheima.domain.User;
import org.apache.ibatis.annotations.Many;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/*
* 用户
* */
public interface UserMapper {

    @Select("select * from user")
    @Results({
            @Result(id=true, property = "id",column = "id"),
            @Result(property = "username",column = "username"),
            @Result(property = "ordersList",column = "id",
                    javaType = List.class,
                    many=@Many(select = "com.itheima.mapper.OrdersMapper.findByUid")
            )
    })
    List<User> findAll();
}
